package com.handsome.备忘录模式;

/**
 * @author niechun
 * @date 2023/3/25 20:47
 */
public class Client {
    public static void main(String[] args) {
        Originator originator=new Originator();
        Caretaker caretaker=new Caretaker();

        //保存当前状态
        originator.setState("状态1 攻击力199");
        caretaker.add(originator.saveMemento());
        originator.setState("状态2 攻击力599");
        caretaker.add(originator.saveMemento());
        originator.setState("状态3 攻击力999");
        caretaker.add(originator.saveMemento());
        //恢复到状态1
        System.out.println("当前状态："+originator.getState());
        System.out.println("恢复后状态："+caretaker.get(0).getState());



    }
}
